package com.elitel.frame.main.dao.ext;

import com.elitel.frame.main.entity.PrjCfgDb;
import com.elitel.frame.main.entity.SysProject;
import com.elitel.frame.main.entity.ext.ExtSysProject;
import com.elitel.frame.main.entity.ext.SysProjectExt;
import com.elitel.frame.main.entity.vo.PageRequestVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface ExtSysProjectMapper {

    List<SysProject> getProjectByPagination(PageRequestVo<SysProject> pr);

    /**
     * @param pr
     * @return SysProject集合
     * @description 查询项目列表
     * @author guoyanfei
     * @date 2017/12/28
     */
    List<SysProject> getProjectByPaginationMysql(PageRequestVo<SysProject> pr);

    List<SysProject> getProjectByPaginationPG(PageRequestVo<SysProject> pr);

    Long getCountByPagination(PageRequestVo<SysProject> pr);

    void deleteProjectConfig(List<String> list);

    List<SysProject> getProjectByPcode(String pcode);

    List<SysProject> getAllProjectList();

    /**
     * show 查询所有项目信息及所配置的服务数量
     *
     * @return SysProjectExt集合
     * @author guoyanfei
     * @date 2017/12/11
     */
    List<SysProjectExt> getAllProjectExtList();

    /**
     * 查询没有配置非结构化文档的项目信息 created by guoyanfei on 2018/04/17
     *
     * @return SysProject实体list集合
     */
    List<SysProject> getProjectNotinDocument();

    /**
     * 批量添加项目对应数据源
     *
     * @param mapParams
     * @return
     */
    int insertProjectToDataSourceBatch(Map<String, Object> mapParams);

    /**
     * 批量添加项目对应数据源(当基础数据源是sqlite时)
     *
     * @param mapParams
     * @return
     */
    int insertProjectToDataSourceBatchSqlite(Map<String, Object> mapParams);

    /**
     * 批量删除项目对应数据源
     *
     * @param pcode
     * @return
     */
    int deleteProjectToDataSourceBatch(String pcode);

    /**
     * 获取项目基本信息
     *
     * @param guid
     * @return
     */
    ExtSysProject selectByGuid(String guid);

    /**
     * 获取项目对应的数据源
     *
     * @param pcode
     * @return
     */
    List<String> selectDataSourceByPcode(String pcode);

    /**
     * 根据用户登录名获取项目列表
     *
     * @param loginname
     * @return
     */
    List<SysProject> selectDataSourceByLoginName(String loginname);

    List<PrjCfgDb> selectDbInfoByPCodeList(@Param("pCodeList") List<String> pCodeList);

    int insertProjectToDataSourceDelBatch(Map<String, Object> mapParams);

    List<SysProject> selectByPrjCode(String prjCode);

    List<SysProject> selectByIdNeqPrjCode(String guid, String prjCode);

    List<SysProject> getProjectJoinDbByPaginationPG(PageRequestVo<SysProject> pr);
}
